<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Customer Status Update</title>
</h:head>
<f:view>
	<h:body>
		<ui:composition template="../includes/template.xhtml">
			<ui:define name="mainbody">
				<center>
					<p:panel header="Customer Status Update"  styleClass="prime_panel">
						<p:growl id="growl" showDetail="true" sticky="false" autoUpdate="true"  showSummary="false" />
						<center>
							<h:form id="form1">
								<p:dataTable style="width: 50%" id="customer" var="customer"
									value="#{customerStatusUpdateBean.customersModel}"
									paginator="true" rows="10" paginatorAlwaysVisible="true"
									selection="#{customerStatusUpdateBean.selectedCustomersList}"
									emptyMessage="Currently there is no Record" >

									<p:column selectionMode="multiple" style="width:18px" />
									<p:column headerText="Customer"
										filterBy="#{customer.schoolName} #{customer.address}"
										style="width:75%" >
				            #{customer.schoolName} - #{customer.address}  
				        </p:column>


									<p:column id="status" headerText="Current Status">
										<center>
											<p:graphicImage height="30" width="30"
												value="#{customer.accountStatus eq true ? '../../images/enabled.png' : '../../images/disabled.png'}" />
										</center>
									</p:column>

									<f:facet name="footer">
										<p:commandButton id="multiViewButton1" value="Update Status"
											update=":form1:displayMulti2"
											oncomplete="multiCustomerDialog.show()"   />
									</f:facet>

								</p:dataTable>

								<p:dialog id="multiDialog" header="Selected Customers"
									widgetVar="multiCustomerDialog" showEffect="fade"
									hideEffect="explode" >

									<p:dataList id="displayMulti2"
										value="#{customerStatusUpdateBean.selectedCustomersList}"
										var="selectedCustomer">
				            School: #{selectedCustomer.schoolName} - #{selectedCustomer.accountStatus eq true ? "Active" : "Blocked" }
				        </p:dataList>

									<table>
										<tr>
											<td><h:outputLabel>Change Status to:</h:outputLabel></td>
											<td><p:selectOneRadio id="options"
													value="#{customerStatusUpdateBean.newStatus}">
													<f:selectItem itemLabel="Enable" itemValue="true" />
													<br />
													<f:selectItem itemLabel="Disable" itemValue="false" />
												</p:selectOneRadio></td>
										</tr>
									</table>
									<p:commandButton id="submit" value="Update" type="submit"
										ajax="false" action="#{customerStatusUpdateBean.perform}" />
								</p:dialog>
							</h:form>
						</center>
					</p:panel>

				</center>
			</ui:define>
		</ui:composition>
	</h:body>
</f:view>
</html>
